{% load comments %}
{% load extra_filters %}
<td id="id_case_text_{{ forloop.counter }}" colspan="12">
	<table class="case_detail">
		<tr>
			<td valign="top">
				<h4>Setup:</h4>
				<div class="content">{{ test_case_text.setup|markdown2html }}</div>
			</td>
			<td class="" valign="top">
				<h4>Breakdown:</h4>
				<div class="content">{{ test_case_text.breakdown|markdown2html }}</div>
			</td>
			<td valign="top" rowspan="2" width="200">
				<h4><span class="title strong">Attachment:</span></h4>
				<ul class="ul-no-format">
					{% for attachment_file in attachments %}
					<li>
						<a href="{% url "mgmt-check_file" attachment_file.attachment_id %}">
							{{ attachment_file.file_name }}
						</a>
					</li>
					{% empty %}
					<li class="grey">No attachment found</li>
					{% endfor %}
				</ul>
				<h4><span class="title strong">Component:</span></h4>
				<ul class="ul-no-format">
					{% for component in components %}
					<li id="display_component" >{{ component.name }}</li>
					{% empty %}
					<li class="grey">No component found</li>
					{% endfor %}
				</ul>
				<h4><span class="title strong">Tag:</span></h4>
				<ul class="ul-no-format">
					{% for tag in tags %}
					<li>{{ tag }}</li>
					{% empty %}
					<li class="grey">No tag found</li>
					{% endfor %}
				</ul>
				<h4><span class="title strong">bug:</span></h4>
				<ul class="ul-no-format">
					{% for bug in test_case.get_bugs %}
					<li>
						<a href="{{ bug.get_full_url }}">{{ bug }}</a>
						{% if bug.case_run_id %}
						<span class="grey"> - From Run</span>
						<a href="{% url "testruns-get" bug.case_run.run_id %}">{{ bug.case_run.run_id }}</a>
						{% endif %}
					</li>
					{% empty %}
					<li class="grey">No bug found</li>
					{% endfor %}
				</ul>
			</td>
		</tr>
		<tr>
			<td class="" valign="top">
				<h4>Actions:</h4>
				<div class="content">{{ test_case_text.action|markdown2html }}</div>
			</td>
			<td class="" valign="top">
				<h4>Expected Results:</h4>
				<div class="content">{{ test_case_text.effect|markdown2html }}</div>
			</td>
		</tr>
		<tr>
			<td colspan='3'>
				<h4>Notes:</h4>
				<div class="content">{{ test_case.notes|urlize|linebreaksbr }}</div>
			</td>
		</tr>
		<tr>
			<td colspan="3" style="border:none; background:none">
				<h4>Comments:</h4>
				<ul class="comment ul-no-format">
				{% for comment in case_comments %}
					<li>
						<span class="strong">#{{ forloop.counter }}</span>
						<span class="strong">
                                                    <a href="{% url "tcms-profile" comment.user.username %}">
                                                       {{ comment.user.username }}
                                                    </a>
                                                </span>
						<span class="grey">{{ comment.submit_date }}</span>
						<br/>
						{{ comment.comment|urlize|linebreaksbr }}

						{% if review_mode and comment.user.pk == user.pk %}
						<form action="{% url "comments-delete" %}" method="post" class="form_comment">
							<input type="hidden" name="comment_id" value="{{ comment.pk }}" />
							<input type="hidden" name="object_pk" value="{{ test_case.pk }}" />
							<input class='commentdelete sprites' value='Delete Comment' type='submit' /> 
						</form>
						{% endif %}
					</li>
				{% endfor %}
				<ul>
			</td>
		</tr>
                {% if review_mode %}
		<tr>
			<td colspan="3" style='border:none;background:transparent'>
				<form class="update_form" method="POST">
					{% get_comment_form for test_case as comment_form %}
					{{ comment_form.comment }}
					{{ comment_form.content_type }}
					{{ comment_form.object_pk }}
					{{ comment_form.timestamp }}
					{{ comment_form.security_hash }}
					<br/>
					<input type="submit" class="submit-post margin-top" value='Add Comment'>
				</form>
			</td>
		</tr>
                {% endif %}
	</table>
</td>
